package com.mega.ycy.mixin;

import com.mega.ycy.Yiciyuan_EVENT;
import net.minecraft.entity.Entity;
import net.minecraft.world.chunk.Chunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@SuppressWarnings({"MixinAnnotationTarget", "UnresolvedMixinReference"})
@Mixin(Chunk.class)
public class ChunkMixin {
    /**
     * @author removeEntityAtIndex
     */
    @Inject(method = "func_76608_a", at = @At("HEAD"), cancellable = true)
    public void removeEntityAtIndex(Entity entityIn, int index, CallbackInfo ci) {
        if (Yiciyuan_EVENT.isSafe(entityIn))
            ci.cancel();
    }
}
